]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
build: Add option to disable portal-helper
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 12 Jun 2024 11:13:41 +0000 (13:13 +0200)
committerMarge Bot <marge-bot@gnome.org>
Thu, 25 Jul 2024 01:51:17 +0000 (01:51 +0000)
The portal login window uses WebKit, which is a security-sensitive
component that not all vendors want to support.

Support that case with a build option, and update the captive
portal handler to use the user's default browser if the portal-helper
is disabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3408>

data/icons/meson.build
data/meson.build
js/meson.build
js/misc/config.js.in
js/misc/meson.build
js/ui/status/network.js
meson.build
meson_options.txt
src/meson.build

index eff6e4b5301b0538c29054cbb241b85722b8263a..277df017b29578c09bac9272a73f682e930cd866 100644 (file)
@@ -1 +1,9 @@
-install_subdir('hicolor', install_dir: icondir)
+excluded_icons=[]
+if not have_portal_helper
+  excluded_icons += [
+    'scalable/apps/org.gnome.Shell.CaptivePortal.svg',
+    'symbolic/apps/org.gnome.Shell.CaptivePortal-symbolic.svg',
+  ]
+endif
+install_subdir('hicolor',
+  install_dir: icondir, exclude_files: excluded_icons)
index 8654dfeca72b54c50e7218678e1c99bebc1fa10e..ed13b6baea5f7aa77977ae95d1f9b10e9c1b4348 100644 (file)
@@ -6,7 +6,7 @@ desktop_files = [
 ]
 service_files = []
 
-if have_networkmanager
+if have_portal_helper
   desktop_files += 'org.gnome.Shell.PortalHelper.desktop'
   service_files += 'org.gnome.Shell.PortalHelper.service'
 endif
index 4809f82b83a2e37cac56e1cbad25bd7971c0631f..e594e23627db859d2f93a0b26eed33a054fbba14 100644 (file)
@@ -8,9 +8,11 @@ js_resources = gnome.compile_resources(
   dependencies: [config_js]
 )
 
-portal_resources = gnome.compile_resources(
-  'portal-resources', 'portal-resources.gresource.xml',
-  source_dir: ['.', meson.current_build_dir()],
-  c_name: 'portal_js_resources',
-  dependencies: [config_js]
-)
+if have_portal_helper
+  portal_resources = gnome.compile_resources(
+    'portal-resources', 'portal-resources.gresource.xml',
+    source_dir: ['.', meson.current_build_dir()],
+    c_name: 'portal_js_resources',
+    dependencies: [config_js]
+  )
+endif
index ad8d46d841f4cf97104708ef4d8858b5a46ec88d..ce319e0f8400ce9ca6584dc68700e2743c83cb03 100644 (file)
@@ -7,6 +7,8 @@ export const PACKAGE_NAME = '@PACKAGE_NAME@';
 export const PACKAGE_VERSION = '@PACKAGE_VERSION@';
 /* 1 if networkmanager is available, 0 otherwise */
 export const HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@;
+/* 1 if portal helper is enabled, 0 otherwise */
+export const HAVE_PORTAL_HELPER = @HAVE_PORTAL_HELPER@;
 /* gettext package */
 export const GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
 /* locale dir */
index 5aceefac42e1fb77ea71830dc90d325147a121e9..5fc8ca433fa3303ab741d93d35c6faa35f44d20b 100644 (file)
@@ -4,6 +4,7 @@ jsconf.set('PACKAGE_VERSION', meson.project_version())
 jsconf.set('GETTEXT_PACKAGE', meson.project_name())
 jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version)
 jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager)
+jsconf.set10('HAVE_PORTAL_HELPER', have_portal_helper)
 jsconf.set('datadir', datadir)
 jsconf.set('libexecdir', libexecdir)
 
index 72b3431daef7b3d46fe627d11c2051bd17379623..cdc9ba892811740cb9b36fd71f88994c047efdcf 100644 (file)
@@ -10,6 +10,7 @@ import Polkit from 'gi://Polkit';
 import Shell from 'gi://Shell';
 import St from 'gi://St';
 
+import * as Config from '../../misc/config.js';
 import * as Main from '../main.js';
 import * as PopupMenu from '../popupMenu.js';
 import * as MessageTray from '../messageTray.js';
@@ -1984,7 +1985,13 @@ class CaptivePortalHandler extends Signals.EventEmitter {
     }
 
     _onNotificationActivated(path) {
-        this._launchPortalHelper(path).catch(logError);
+        const context = global.create_app_launch_context(
+            global.get_current_time(), -1);
+
+        if (Config.HAVE_PORTAL_HELPER)
+            this._launchPortalHelper(path, context).catch(logError);
+        else
+            Gio.AppInfo.launch_default_for_uri(this._checkUri, context);
 
         Main.overview.hide();
         Main.panel.closeCalendar();
@@ -2007,8 +2014,7 @@ class CaptivePortalHandler extends Signals.EventEmitter {
         }
     }
 
-    async _launchPortalHelper(path) {
-        const timestamp = global.get_current_time();
+    async _launchPortalHelper(path, context) {
         if (!this._portalHelperProxy) {
             this._portalHelperProxy = new Gio.DBusProxy({
                 g_connection: Gio.DBus.session,
@@ -2030,6 +2036,7 @@ class CaptivePortalHandler extends Signals.EventEmitter {
             }
         }
 
+        const {timestamp} = context;
         this._portalHelperProxy?.AuthenticateAsync(path, this._checkUri, timestamp).catch(logError);
         this._connectivityQueue.add(path);
     }
index 035f54732af00c0af098c4a68b1d9cffc3d2748c..4721bd6017235f016999edb5ce09e2a4aa9b8d88 100644 (file)
@@ -107,6 +107,11 @@ else
   have_networkmanager = false
 endif
 
+have_portal_helper = get_option('portal_helper')
+if have_portal_helper and not have_networkmanager
+  error('Portal helper requires networkmanager support')
+endif
+
 if get_option('camera_monitor')
   libpipewire_dep = dependency('libpipewire-0.3', version: pipewire_req)
   have_pipewire = true
index 6e83d92f2efd6641ad6bb1a65186a4822b7c46d8..01e0d5803b17eb47e632eb9a60ff58be7483019b 100644 (file)
@@ -40,6 +40,12 @@ option('networkmanager',
   description: 'Enable NetworkManager support'
 )
 
+option('portal_helper',
+  type: 'boolean',
+  value: true,
+  description: 'Enable build-in network portal login'
+)
+
 option('systemd',
   type: 'boolean',
   value: true,
index 752104e120114d39ecf8af54208b4df73a36466f..a3bf54248025341ca9ed0279dbfded1de31ae5d1 100644 (file)
@@ -286,7 +286,7 @@ executable('gnome-shell', 'main.c',
   install: true
 )
 
-if have_networkmanager
+if have_portal_helper
   executable('gnome-shell-portal-helper',
     'gnome-shell-portal-helper.c', portal_resources,
     c_args: tools_cflags,